/*
 * @Author: your name
 * @Date: 2020-06-15 14:57:57
 * @LastEditTime: 2020-06-15 15:02:02
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \codeSnippet\server\app\controller\base.js
 */
'use strict'

const { Controller } = require('egg')

class BaseController extends Controller {
  success(data) {
    this.ctx.body = {
      code: 0,
      data,
    }
  }
  message(message) {
    this.ctx.body = {
      code: 0,
      message,
    }
  }

  error(message, code = -1, errors = {}) {
    this.ctx.body = {
      code, message, errors,
    }
  }
}

module.exports = BaseController
